package com.lanou3g.ptp.grade.mapper;

import com.lanou3g.ptp.entity.GradeTeacher;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface GradeTeacherMapper {
    @Select("SELECT * FROM grade_teacher WHERE student_id=#{studentId} AND task_id=#{taskId}")
    GradeTeacher findByStudentIdAndTaskId(@Param("studentId") Long studentId, @Param("taskId") Long taskId);

    @Insert("INSERT INTO grade_teacher(base_teacher_id,score,task_id,student_id) " +
            "VALUES(#{baseTeacherId},#{score},#{taskId},#{studentId})")
    int insert(GradeTeacher gradeTeacher);

    @Select("SELECT * FROM grade_teacher WHERE task_id=#{taskId}")
    List<GradeTeacher> findByTaskId(Long taskId);
}
